package com.ruoyi.web.controller.system;


import com.ruoyi.web.service.C2DeploySucRateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/api/C2DeploySucRate")
public class C2DeploySucRateController {

    @Autowired
    private C2DeploySucRateService c2DeploySucRateService;

    /**
     * 获取每个月 C2 发布成功率的接口
     *
     * @return 包含月份、总条目数、成功条目数和百分比的 JSON 数据
     */
    @GetMapping("/byWeeks")
    public Map<String, Object> getC2DeploySucRateByWeek() {
        return c2DeploySucRateService.getC2DeploySucRateByWeeks();
    }

    @GetMapping("/byMonth")
    public Map<String, Object> getC2DeploySucRateByMonth() {
        return c2DeploySucRateService.getC2DeploySucRateByMonth();
    }

    /**
     * 获取每季度 C2 发布成功率的接口
     *
     * @return 包含季度、总条目数、成功条目数和百分比的 JSON 数据
     */
    @GetMapping("/byQuarters")
    public Map<String, Object> getC2DeploySucRateByQuarters() {
        return c2DeploySucRateService.getC2DeploySucRateByQuarters();
    }

    @GetMapping("/byYears")
    public Map<String, Object> getC2DeploySucRateByYears() {
        return c2DeploySucRateService.getC2DeploySucRateByYears();
    }
}